//
//  main.m
//  05-Foundation-NSSet
//
//  Created by Jason on 15/10/4.
//  Copyright © 2015年 Jason. All rights reserved.
//

/*
 Array和Set的区别
 1. array的元素是有序的,set的元素是无序的
 2. array允许存放相同的元素,set不允许存放相同的内容
 */
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        
        
        NSArray *array = [NSArray arrayWithObjects:@"mike", @"mike",@"mike", nil];
        
        NSLog(@"array=%@",array);
        
        NSSet *set1 = [NSSet setWithObjects:@"mike",@"mike", @"mike", nil];
        NSLog(@"set1 = %@", set1);
        
        
        
        
       NSSet *set =  [NSSet setWithObjects:@"jack",@"mike",@"rose", nil];
        
        /*
        for (int i = 0; i < 10; i++) {
            id obj = [set anyObject];
            NSLog(@"%@",obj);
        }
         */
        
        [set enumerateObjectsUsingBlock:
         ^(id  _Nonnull obj, BOOL * _Nonnull stop) {
           
             NSLog(@"%@", obj);
        }];
        
        
        NSMutableSet *set2 = [NSMutableSet set];
        [set2 addObject:@"jack"];
        [set2 addObject:@"mike"];
        
        
        
    }
    return 0;
}
